import { unreadNum } from '@/api/Classify'
export default defineStore('useCommon', {
  state: () => ({
    message_num: 0,
  }),
  getters: {},
  actions: {
    // 设置消息数量
    async SET_MESSAGE_NUM(data) {
      this.message_num = data
    },
    // 获取消息数量
    async getMessageNum() {
      let url = $globalRequestUrl({
        url: unreadNum,
      })

      try {
        const rep = await $globalRequest(url, {}, { method: 'GET' })
        return rep
      } catch (error) {
        return error
      }
    },
  },
})
